import React, {useContext, useEffect, useRef, useState} from 'react';
import {
    ActivityIndicator,
    Alert,
    Dimensions,
    ImageBackground,
    ScrollView,
    TextInput,
    TouchableOpacity,
    View,
    Animated, Keyboard, KeyboardAvoidingView, Platform
} from 'react-native';
import {Icon, Text, Tooltip} from 'react-native-elements';

import LocaleContext from '../libs/locale';

import WalletContext from "../libs/wallet";
import {useFocusEffect} from "@react-navigation/native";

import logo from '../assets/logo.png';
import {
    getBestNode,
    getCurrentNodeHeight,
    getNonce,
    getRandomUrl, getTransferCount,
    getTxInfo,
    getTxs,
    getTxs_Ip, request_tran,
    SaveMyID, savetraninfo,
    transfer
} from "../libs/nodes";
import {addTx, getTxs as getPendingTxs, getTxs2, popTx, saveTX, saveTXone} from "../libs/pendingTxs";
import {constansts} from "../libs/constansts";
import AsyncStorage from "@react-native-async-storage/async-storage";
import {formartMoney, sleep, timeFormat} from "../libs/helpers";
import Clipboard from "@react-native-community/clipboard";
import Toast from "react-native-simple-toast";
import {bytes2Hex, hex2Bytes, hex2Bytes_Random, keyPairFromSeed, sign as keyPairSign} from "../libs/keyPair";
import {convertKeyPair, convertPublicKey} from "../libs/ed2curve";
import Cp from "crypto-js";
import CryptoJS from "crypto-js";
import {TouchableHighlight} from "react-native-gesture-handler";
import ChatTranDetail from "../components/ChatTranDetail";
import ChatInput from "../components/ChatInput";
// import {KeyboardAccessoryView, KeyboardUtils} from 'react-native-keyboard-input';



const {width,height,scale} = Dimensions.get("window");
let initInputHeight = width/360*35;
//判断在最底部
let isButtom = true;
//当前界面的消息
let Q_ChatNow:any = [];
//是否离开界面
let unDoIt = false;
const ChatGroupView = ({ navigation ,route}: any) =>
{
    const locale:any = useContext(LocaleContext);
    const wallet: any = useContext(WalletContext);
    //传输参数
    const title = route?.params?.selfRemark?route?.params?.selfRemark:route?.params?.desc;
    const Q_Address = route?.params?.Q_Address;
    const Q_Key = route?.params?.Q_Key;
    const QP_Priv = route?.params?.QP_Priv;
    const Creator = route?.params?.Creator;
    //发送按钮数据
    const [sending,setSending] = useState(false)
    const [SendMsg,setSendMsg] = useState("");
    //群聊的信息
    const [Q_Chat,setQ_Chat]:any = useState([]);
    //显示删除详情的东西
    const [showPickIndex,setShowPickIndex] = useState(-1);
    //ref_ScrollView
    const ref_ScrollView = useRef(null);
    //判断滚动到底部了
    const [onButtom, setOnButtom] = useState(true);
    //输入框高度
    const [inputHeight,setInputHeight] = useState(initInputHeight)

    //进度条
    const [showWaiting,setShowWaiting] = useState(false)
    const [progressLength,setProgressLength] = useState("0")
    const [TipInfo,setTipInfo] = useState("")

    const setTitle = (title:string) => {
        navigation.setOptions({title: title})
    }

    //初始化一下标题和二维码按钮
    useEffect(() => {
        console.log(Q_Key)
        isButtom = true;
        unDoIt = false;
        setTitle(title);
        navigation.setOptions({
            headerRight: () => (
                <TouchableOpacity style={{
                    width: 35,
                    height: 35,
                    marginRight: 20,
                    alignItems: "center",
                    justifyContent: "center"
                }}
                                  onPress={ () => {
                                    navigation.navigate("ChatGroupDetail",{Q_Address,Q_Key,QP_Priv,Creator,desc:route?.params?.desc});
                                  }}
                >
                    <Icon type='feather' name="more-horizontal" color={'#696969'} size={width/360*30} style={{}} />
                </TouchableOpacity>


            ),
        });
    },[])
    //初始化一下消息数据
    useEffect(() => {
        const work = async () => {
            let ChatGroupList = await AsyncStorage.getItem("Q_Chat_"+Q_Address) || "[]";
            Q_ChatNow = JSON.parse(ChatGroupList) || [];
            setQ_Chat([...Q_ChatNow]);
            scrollToEnd();
        }
        work();
    } ,[])
    //定时器获取群聊消息
    useEffect(()=>{
        let address = Q_Address ;
        const interval_GetInfo = async () => {
            if(unDoIt)
            {
                return ;
            }
            await saveNetMsg(address);
            scrollToEnd();
            if(unDoIt)
            {
                return ;
            }
            setTimeout(interval_GetInfo,10*1000);
        }
        setTimeout(interval_GetInfo,10*1000);
        return () => {
            console.log("BackMain")
            unDoIt = true;
            AsyncStorage.setItem("Q_Chat_" + address, JSON.stringify(Q_ChatNow)).then(()=>{
            });
        }
    },[])
    //进入动画
    useEffect(()=>{
        //第一次获取历史交易
        const getHistory = async (address:string) => {
            setProgressLength("0.1")
            var info: any = [];
            //获取最多12000笔交易的信息
            let LastTime: number;
            try {
                LastTime = parseInt(await AsyncStorage.getItem("LastGetTime_"+address) as string) - 1;
                if(new Date().getTime() - LastTime > constansts.chatSearchMaxTime)
                {
                    LastTime = new Date().getTime() - constansts.chatSearchMaxTime;
                }
            }catch (e) {
                LastTime = new Date().getTime() - constansts.chatSearchMaxTime;
            }

            for (let i = 0; i < Math.floor(constansts.chatSearchMaxLength/12); i++) {

                let res = [];
                res = await getTxs(address, i);
                info.splice(12 * (i + 1) - 1, 0, ...res);
                let nowGetTime = 0;
                try {
                    nowGetTime = parseInt(res[res.length - 1].timestamp);
                }catch (e) {

                }
                let pL = parseFloat(progressLength);
                try {
                    pL = (constansts.chatSearchMaxTime - (res[res.length - 1].timestamp - LastTime)) / constansts.chatSearchMaxTime*0.8;
                }catch (e) {

                }
                setProgressLength(pL>0.8?"0.8":pL.toString() );

                if (info.length !== (i + 1) * 12 || nowGetTime <= LastTime) {
                    setProgressLength("0.8")
                    break;
                }
            }
            if(info.length > 0 && !unDoIt) {
                await AsyncStorage.setItem("LastGetTime_" + address, info[0].timestamp.toString());
            }
            return info;
        }
        //第一次将得到的消息数据进行解析放入数组等待比较
        const solveTran = async (info:any) => {

            const doSetpL = async (i: any, info: any) => {
                await sleep(1)
                let pL = 0.8 + (i / info.length) * 0.1;
                let pLM = Math.floor(pL * 100) / 100;

                setProgressLength(pLM.toString());

            }

            //信息解密
            const decryptedInformation = async (item:any,Key:string) =>{
                await sleep(0)
                let timetemp_decry = new Date().getTime()
                try {
                    let nacl = require("tweetnacl");
                    //将字符串转成字节数组
                    let decodeUTF8 = function (s: string) {
                        var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
                        for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
                        return b;
                    };
                    //将字节数组转成字符串
                    let encodeUTF8 = function (arr: any) {
                        var i, s = [];
                        for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
                        return decodeURIComponent(escape(s.join('')));
                    };
                    //设置随机nonce值
                    nacl.setPRNG((x: any, n: any) => {
                        x = hex2Bytes_Random(n);
                    })
                    // 随机nonce值
                    let nonceRandom = nacl.randomBytes(24);
                    let DHKeyMy:any = convertKeyPair(keyPairFromSeed(wallet.seed));

                    //获取他的公钥
                    let data = JSON.parse(item.remarks);
                    var decryptedMessage = nacl.secretbox.open(hex2Bytes(data.msg), nonceRandom,hex2Bytes(Key));
                    let res = encodeUTF8(decryptedMessage)
                    return res;
                }catch (e) {
                    return false;
                }
            }

            var ChatListTemp:any = [];

            for (let i = 0; i < info.length; i++) {
                await doSetpL(i,info);
                try {

                    let remarks = JSON.parse(info[i].remarks);
                    if (remarks.type !== "Gchat") {
                        continue;
                    }
                    let remarksMsgStr = await decryptedInformation(info[i],Q_Key);
                    if(!remarksMsgStr)
                    {
                        continue;
                    }
                    info[i].remarks = JSON.stringify({height:info[i].height,receiver:info[i].addressOut,hash:info[i].hash,type:"Gchat",msg:remarksMsgStr,sender:info[i].addressIn});
                } catch (e) {

                    continue;
                }

                let remarks = JSON.parse(info[i].remarks);

                ChatListTemp.push({height:info[i].height,receiver:info[i].addressOut,hash:info[i].hash,sender: info[i].addressIn, msg: remarks.msg, timeStamp: info[i].timestamp});
            }

            return ChatListTemp;
        }
        //第一次将得到的数组进行比较，然后写入数据库
        const saveMsg = async (ChatListTemp: any,address:string) => {

            const doSetpL = async (i: any, info: any) => {
                await sleep(1)
                let pL = 0.9 + (i / info.length) * 0.1;
                let pLM = Math.floor(pL * 100) / 100;
                setProgressLength(pLM.toString());
            }

            //添加数据量的限制
            let maxInfoLength = constansts.Q_ChatInfoMaxLength;

            //将数据添加进去，如果发现时间戳一样并且，发送人一样的数据将发送中标识去除
            for (let i = 0; i < ChatListTemp.length; i++) {
                await doSetpL(i,ChatListTemp)
                //本来就没有消息直接放进去
                if (Q_ChatNow.length === 0) {
                    Q_ChatNow.push(ChatListTemp[i]);
                    continue;
                }
                //有消息遍历一下，如果有相同的就修改一下状态，没有相同的就直接放进去
                for (let ii = 0; ii < Q_ChatNow.length; ii++) {
                    //如果里面已经有这条消息的话，就可以直接修改状态
                    if (ChatListTemp[i].hash === Q_ChatNow[ii].hash) {
                        //修改数据状态
                        Q_ChatNow[ii].showFalse = false;
                        Q_ChatNow[ii].showTraning = false;
                        Q_ChatNow[ii].height = ChatListTemp[i].height;
                        break;
                    }
                    if(ii===0 && ChatListTemp[i].timeStamp < Q_ChatNow[ii].timeStamp)
                    {
                        if(Q_ChatNow.length >= maxInfoLength)
                        {
                            break;
                        }
                        Q_ChatNow.splice(0,0,ChatListTemp[i]);
                        break
                    }
                    //新的消息
                    if(ii < (Q_ChatNow.length - 1) && ChatListTemp[i].timeStamp < Q_ChatNow[ii+1].timeStamp)
                    {
                        let k=ii+1;
                        if(Q_ChatNow.length >= maxInfoLength)
                        {
                            Q_ChatNow.shift();
                            k--;
                        }
                        Q_ChatNow.splice(k,0,ChatListTemp[i]);
                        break;
                    }
                    //到了最后一个也没有满足条件的消息，就直接添加进去
                    if(ii === (Q_ChatNow.length - 1))
                    {
                        if(Q_ChatNow.length >= maxInfoLength)
                        {
                            Q_ChatNow.shift();
                        }
                        Q_ChatNow.push(ChatListTemp[i]);
                        break;
                    }
                }
            }

            //最后将那些还没有去除发送标识的人，比较一下发送时间，时间过了2分钟就查询后判断一下将它设置为丢失或者成功
            for (let i = 0; i < Q_ChatNow.length; i++) {
                let data = Q_ChatNow[i];
                if (data.showTraning && ((new Date().getTime()) - data.timeStamp) > (2 * 60 * 1000) && data.display !== false) {
                    let HashInfo = await getTxInfo(data.hash);
                    if (data.falseTime <= 0 && (HashInfo == false || HashInfo.height == 0)) {
                        data.showFalse = true;
                        data.showTraning = false;
                        data.height = -2;
                    }
                    data.falseTime -= 1;
                    if(HashInfo.height > 0)
                    {
                        data.showFalse = false;
                        data.showTraning = false;
                        data.height = HashInfo.height;
                    }
                }
                Q_ChatNow[i] = data;
            }
            if(!unDoIt) {
                setQ_Chat([...Q_ChatNow]);
            }

            //渲染一下


            return Q_ChatNow;
        }
        //第一次检查是否需要去网络上重新获取数据
        const checkNeedUpdate = async (address:string) => {
            let beforeTransferCountStr: string | null = "0";
            try {
                beforeTransferCountStr = await AsyncStorage.getItem("Q_tranCount_"+address);
            }catch (e) {
                beforeTransferCountStr = "0";
            }
            if(beforeTransferCountStr == null || beforeTransferCountStr == "0")
            {
                let newTransferCount = await getTransferCount(address);

                await AsyncStorage.setItem("Q_tranCount_"+address,newTransferCount.count.toString());
                return true;

            }
            let beforeTransferCount = parseInt(beforeTransferCountStr);

            let newTransferCount = await getTransferCount(address);

            if(newTransferCount.count > beforeTransferCount)
            {
                await AsyncStorage.setItem("Q_tranCount_"+address,newTransferCount.count.toString());
                return true;
            }
            return false;
        }
        //第一次检查未完成的交易
        const checkTransferring = async (address:string) => {
            let data = Q_ChatNow;
            for (let i = 0; i < Q_ChatNow.length; i++) {
                if (data[i].showTraning && ((new Date().getTime()) - data[i].timeStamp) > (2 * 60 * 1000) && data[i].display !== false) {
                    let HashInfo = await getTxInfo(data[i].hash);
                    if (data[i].falseTime <= 0 && (HashInfo == false || HashInfo.height == 0)) {
                        data[i].showFalse = true;
                        data[i].showTraning = false;
                        data[i].height = -2;
                    }
                    data[i].falseTime -= 1;
                    if(HashInfo.height > 0)
                    {
                        data[i].showFalse = false;
                        data[i].showTraning = false;
                        data[i].height = HashInfo.height;
                    }
                    Q_ChatNow[i] = data[i];
                }
            }
            if(!unDoIt)
            {
                setQ_Chat([...Q_ChatNow]);
            }

        }
        //第一次获取网络数据，来检查交易是否成功和新增的聊天数据
        const saveNetMsg = async (address: string) => {
            setShowWaiting(true)
            setTipInfo("获取网络数据");
            //如果不需要更新数据，那就不动
            if (!await checkNeedUpdate(address)) {
                await checkTransferring(address);
                setProgressLength("1");
                setTimeout(()=>{
                    setShowWaiting(false)
                    setProgressLength("0");
                },300)
                return;
                //后面补上交易丢失问题
            }
            //需要更新数据，先去拉去数据
            //获取最新交易

            var info = await getHistory(address);
            setTipInfo("解析网络数据");
            //将得到的消息数据进行解析放入数组等待比较
            var ChatListTemp = await solveTran(info);

            //将得到的数组进行比较，然后写入数据库
            let res = await saveMsg(ChatListTemp,address);
            setShowWaiting(false)
            setProgressLength("0")

            return res;

        }
        saveNetMsg(Q_Address);
    },[])

    //获取历史交易
    const getHistory = async (address:string) => {
        var info: any = [];
        //获取最多12000笔交易的信息
        let LastTime: number;
        try {
            LastTime = parseInt(await AsyncStorage.getItem("LastGetTime_"+address) as string) - 1;
            if(new Date().getTime() - LastTime > constansts.chatSearchMaxTime)
            {
                LastTime = new Date().getTime() - constansts.chatSearchMaxTime;
            }
        }catch (e) {
            LastTime = new Date().getTime() - constansts.chatSearchMaxTime;
        }

        for (let i = 0; i < Math.floor(constansts.chatSearchMaxLength/12); i++) {
            let res = [];
            res = await getTxs(address, i);
            info.splice(12 * (i + 1) - 1, 0, ...res);
            let nowGetTime = 0;
            try {
                nowGetTime = parseInt(res[res.length - 1].timestamp);
            }catch (e) {
            }
            if (info.length !== (i + 1) * 12 || nowGetTime <= LastTime) {
                break;
            }
        }
        if(info.length > 0 && !unDoIt) {
            await AsyncStorage.setItem("LastGetTime_" + address, info[0].timestamp.toString());
        }
        return info;
    }
    //将得到的消息数据进行解析放入数组等待比较
    const solveTran = async (info:any) => {

        //信息解密
        const decryptedInformation = async (item:any,Key:string) =>{
            await sleep(0)
            let timetemp_decry = new Date().getTime()
            try {
                let nacl = require("tweetnacl");
                //将字符串转成字节数组
                let decodeUTF8 = function (s: string) {
                    var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
                    for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
                    return b;
                };
                //将字节数组转成字符串
                let encodeUTF8 = function (arr: any) {
                    var i, s = [];
                    for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
                    return decodeURIComponent(escape(s.join('')));
                };
                //设置随机nonce值
                nacl.setPRNG((x: any, n: any) => {
                    x = hex2Bytes_Random(n);
                })
                // 随机nonce值
                let nonceRandom = nacl.randomBytes(24);
                let DHKeyMy:any = convertKeyPair(keyPairFromSeed(wallet.seed));

                //获取他的公钥
                let data = JSON.parse(item.remarks);
                var decryptedMessage = nacl.secretbox.open(hex2Bytes(data.msg), nonceRandom,hex2Bytes(Key));
                let res = encodeUTF8(decryptedMessage)
                return res;
            }catch (e) {
                return false;
            }
        }

        var ChatListTemp:any = [];
        for (let i = 0; i < info.length; i++) {
            await sleep(0);
            try {

                let remarks = JSON.parse(info[i].remarks);
                if (remarks.type !== "Gchat") {
                    continue;
                }
                let remarksMsgStr = await decryptedInformation(info[i],Q_Key);
                if(!remarksMsgStr)
                {
                    continue;
                }
                info[i].remarks = JSON.stringify({height:info[i].height,receiver:info[i].addressOut,hash:info[i].hash,type:"Gchat",msg:remarksMsgStr,sender:info[i].addressIn});
            } catch (e) {

                continue;
            }

            let remarks = JSON.parse(info[i].remarks);

            ChatListTemp.push({height:info[i].height,receiver:info[i].addressOut,hash:info[i].hash,sender: info[i].addressIn, msg: remarks.msg, timeStamp: info[i].timestamp});
        }

        return ChatListTemp;
    }
    //将得到的数组进行比较，然后写入数据库
    const saveMsg = async (ChatListTemp: any,address:string) => {
        //添加数据量的限制
        let maxInfoLength = constansts.Q_ChatInfoMaxLength;

        //将数据添加进去，如果发现时间戳一样并且，发送人一样的数据将发送中标识去除
        for (let i = 0; i < ChatListTemp.length; i++) {
            //本来就没有消息直接放进去
            if (Q_ChatNow.length === 0) {
                Q_ChatNow.push(ChatListTemp[i]);
                continue;
            }
            //有消息遍历一下，如果有相同的就修改一下状态，没有相同的就直接放进去
            for (let ii = 0; ii < Q_ChatNow.length; ii++) {
                //如果里面已经有这条消息的话，就可以直接修改状态
                if (ChatListTemp[i].hash === Q_ChatNow[ii].hash) {
                    //修改数据状态
                    Q_ChatNow[ii].showFalse = false;
                    Q_ChatNow[ii].showTraning = false;
                    Q_ChatNow[ii].height = ChatListTemp[i].height;
                    break;
                }
                if(ii===0 && ChatListTemp[i].timeStamp < Q_ChatNow[ii].timeStamp)
                {
                    if(Q_ChatNow.length >= maxInfoLength)
                    {
                        break;
                    }
                    Q_ChatNow.splice(0,0,ChatListTemp[i]);
                    break
                }
                //新的消息
                if(ii < (Q_ChatNow.length - 1) && ChatListTemp[i].timeStamp < Q_ChatNow[ii+1].timeStamp)
                {
                    let k=ii+1;
                    if(Q_ChatNow.length >= maxInfoLength)
                    {
                        Q_ChatNow.shift();
                        k--;
                    }
                    Q_ChatNow.splice(k,0,ChatListTemp[i]);
                    break;
                }
                //到了最后一个也没有满足条件的消息，就直接添加进去
                if(ii === (Q_ChatNow.length - 1))
                {
                    if(Q_ChatNow.length >= maxInfoLength)
                    {
                        Q_ChatNow.shift();
                    }
                    Q_ChatNow.push(ChatListTemp[i]);
                    break;
                }
            }
        }

        //最后将那些还没有去除发送标识的人，比较一下发送时间，时间过了2分钟就查询后判断一下将它设置为丢失或者成功
        for (let i = 0; i < Q_ChatNow.length; i++) {
                let data = Q_ChatNow[i];
                if (data.showTraning && ((new Date().getTime()) - data.timeStamp) > (2 * 60 * 1000) && data.display !== false) {
                    let HashInfo = await getTxInfo(data.hash);
                    if (data.falseTime <= 0 && (HashInfo == false || HashInfo.height == 0)) {
                        data.showFalse = true;
                        data.showTraning = false;
                        data.height = -2;
                    }
                    data.falseTime -= 1;
                    if(HashInfo.height > 0)
                    {
                        data.showFalse = false;
                        data.showTraning = false;
                        data.height = HashInfo.height;
                    }
                }
            Q_ChatNow[i] = data;
        }
        if(!unDoIt) {
            setQ_Chat([...Q_ChatNow]);
            await AsyncStorage.setItem("Q_Chat_" + Q_Address, JSON.stringify(Q_ChatNow)).then(()=>{
                console.log("群地址："+Q_Address)
            });
        }

        //渲染一下


        return Q_ChatNow;
    }
    //检查是否需要去网络上重新获取数据
    const checkNeedUpdate = async (address:string) => {
        let beforeTransferCountStr: string | null = "0";
        try {
            beforeTransferCountStr = await AsyncStorage.getItem("Q_tranCount_"+address);
        }catch (e) {
            beforeTransferCountStr = "0";
        }
        if(beforeTransferCountStr == null || beforeTransferCountStr == "0")
        {
            let newTransferCount = await getTransferCount(address);

            await AsyncStorage.setItem("Q_tranCount_"+address,newTransferCount.count.toString());
            return true;

        }
        let beforeTransferCount = parseInt(beforeTransferCountStr);

        let newTransferCount = await getTransferCount(address);

        if(newTransferCount.count > beforeTransferCount)
        {
            await AsyncStorage.setItem("Q_tranCount_"+address,newTransferCount.count.toString());
            return true;
        }
        return false;
    }
    //检查未完成的交易
    const checkTransferring = async (address:string) => {
        let data = Q_ChatNow;
        for (let i = 0; i < Q_ChatNow.length; i++) {
            if (data[i].showTraning && ((new Date().getTime()) - data[i].timeStamp) > (2 * 60 * 1000) && data[i].display !== false) {
                let HashInfo = await getTxInfo(data[i].hash);
                if (data[i].falseTime <= 0 && (HashInfo == false || HashInfo.height == 0)) {
                    data[i].showFalse = true;
                    data[i].showTraning = false;
                    data[i].height = -2;
                }
                data[i].falseTime -= 1;
                if(HashInfo.height > 0)
                {
                    data[i].showFalse = false;
                    data[i].showTraning = false;
                    data[i].height = HashInfo.height;
                }
                Q_ChatNow[i] = data[i];
            }
        }
        if(!unDoIt)
        {
            setQ_Chat([...Q_ChatNow]);
            await AsyncStorage.setItem("Q_Chat_" + Q_Address, JSON.stringify(Q_ChatNow)).then(()=>{
                console.log("群地址："+Q_Address)
            });
        }

    }
    //获取网络数据，来检查交易是否成功和新增的聊天数据
    const saveNetMsg = async (address: string) => {
        //如果不需要更新数据，那就不动
        if (!await checkNeedUpdate(address)) {
            await checkTransferring(address);
            return;
            //后面补上交易丢失问题
        }
        //需要更新数据，先去拉去数据
        //获取最新交易
        var info = await getHistory(address);

        //将得到的消息数据进行解析放入数组等待比较
        var ChatListTemp = await solveTran(info);

        //将得到的数组进行比较，然后写入数据库
        let res = await saveMsg(ChatListTemp,address);

        return res;

    }
    //发送交易，插入数据
    const insertData_Transfer = async (tranInfo: any, address: string) => {
        //聊天信息大于100条将剔除
        if (Q_ChatNow.length > constansts.Q_ChatInfoMaxLength) {
            Q_ChatNow.shift();
        }
        Q_ChatNow.push({
            height: tranInfo.height,
            receiver: tranInfo.addressOut,
            sender: wallet.address,
            msg: SendMsg,
            showTraning: true,
            showFalse: false,
            hash: tranInfo.hash,
            timeStamp: tranInfo.trantime,
            falseTime: 2
        });
        setQ_Chat([...Q_ChatNow])
        await AsyncStorage.setItem("Q_Chat_" + Q_Address, JSON.stringify(Q_ChatNow)).then(()=>{
            console.log("群地址："+Q_Address)
        });
    }
    //加密聊天信息
    const encryptedInformation_Key = (remarks:string,Key:string) =>{
            try {
                let nacl = require("tweetnacl");
                //获取自己的公钥
                let getPublicKeyByte = () => {
                    let keyPair: any = keyPairFromSeed(wallet.seed);
                    let publicKey = keyPair.publicKey;
                    return convertPublicKey(publicKey);
                }
                //将字符串转成字节数组
                let decodeUTF8 = function (s: string) {
                    var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
                    for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
                    return b;
                };
                //将字节数组转成字符串
                let encodeUTF8 = function (arr: any) {
                    var i, s = [];
                    for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
                    return decodeURIComponent(escape(s.join('')));
                };
                //设置随机nonce值
                nacl.setPRNG((x: any, n: any) => {
                    x = hex2Bytes_Random(n);
                })
                // 随机nonce值
                let nonceRandom = nacl.randomBytes(24);

                // 先用我的私钥加密和另一个号的公钥加密

                var anotherMessage = decodeUTF8(remarks);
                let keyByte = hex2Bytes(Key);
                var encryptedMessage = nacl.secretbox(anotherMessage, nonceRandom, keyByte);
                let res = bytes2Hex(encryptedMessage);
                return res;
            }catch (e) {
                return false;
            }

        }
    //聊天列表中显示上次聊天的时间
    const showTime = (nowTime: number, beforeTimeIndex: number) => {
        if(beforeTimeIndex === 0)
        {
            return true;
        }
        let beforeTime = Q_Chat[(beforeTimeIndex-1)<0?0:(beforeTimeIndex-1)].timeStamp || 0;

        if(nowTime - beforeTime > 5*60*1000)
        {
            return true;
        }

        return false;
    }
    //显示删除详情框
    const showPick = (nowindex:number) => {
        return showPickIndex===nowindex;
    }
    //复制
    const onCopy = (data:any) => {
        Clipboard.setString(data);
        Toast.show(locale?._('copied') as string);
    };
    //判断在ScrollView底部了
    const contentViewScroll = (e: any) => {
        var offsetY = e.nativeEvent.contentOffset.y; //滑动距离
        var contentSizeHeight = e.nativeEvent.contentSize.height; //scrollView contentSize高度
        var oriageScrollHeight = e.nativeEvent.layoutMeasurement.height; //scrollView高度
        if (offsetY + oriageScrollHeight >= (contentSizeHeight-1)){
            console.log("到底了")
            isButtom = true;
            setOnButtom(true);
        }
        else {
            console.log("未到底")
            isButtom = false;
            setOnButtom(false);
        }
    }
    //让滚动条滚动到底部
    const scrollToEnd = () => {
        setTimeout(()=>{
            if(ref_ScrollView == null)
            {
                return;
            }
            try {
                if(isButtom)
                    (ref_ScrollView as any).current.scrollToEnd({animated: false})
            }catch (e) {

            }
        },0);//进入时让其滑动到底部
    }
    //交易详情
    const [Detail_addressIn,setDetail_addressIn] = useState("");
    const [Detail_addressOut,setDetail_addressOut] = useState("");
    const [Detail_timeStamp,setDetail_timeStamp] = useState("");
    const [Detail_blockHeight,setDetail_blockHeight] = useState(0);
    const [Detail_hash,setDetail_hash] = useState("");
    const [Detail_msg,setDetail_msg] = useState("");
    const [Detail_visible,setDetail_visible] = useState(false);
    //交易详情退出函数
    const Detail_back = (res:boolean) => {
        if(!res)
        {
            setDetail_visible(false);
        }
    }
    //设置详情内容
    const setDetailInfo = (item:any) => {
        setDetail_addressIn(item.sender);
        setDetail_addressOut(item.receiver);
        setDetail_timeStamp(item.timeStamp);
        setDetail_blockHeight(item.height);
        setDetail_hash(item.hash);
        setDetail_msg(item.msg)
        setDetail_visible(true);
    }


    //设置内容ScrollView高度
    const [scrollHeight,setScrollHeight] = useState(height);
    //监听软键盘弹出
    // useEffect(() => {
    //     const showSubscription = Keyboard.addListener("keyboardDidShow", () => {
    //         try {
    //             let res = height - 200;
    //             console.log(scrollHeight)
    //             setScrollHeight(res);
    //             (ref_ScrollView as any).current.scrollToEnd({animated: true})
    //             setTimeout(()=>{
    //                 // console.log('onFocus is excuted....');
    //             },200)
    //         }catch (e) {
    //             // console.log("refs not null ")
    //         }
    //     });
    //     // const hideSubscription = Keyboard.addListener("keyboardDidHide", () => {
    //     // });
    //     return () => {
    //         showSubscription.remove();
    //         // hideSubscription.remove();
    //     };
    // }, []);

    //输入框详情
    // const [Input_msg,setInput_msg] = useState("");
    const [Input_visible,setInput_visible] = useState(false);
    //输入框三个操作函数
    const Input_back = async (res: any) => {
        if (res.type == "return") {
            setInput_visible(false);
        }
        else if (res.type == "send") {
            if (SendMsg == "") {
                return;
            }
            setSending(true)
            setInput_visible(false)
            try {
                let remarks = encryptedInformation_Key(SendMsg, Q_Key);
                setSendMsg("");
                setTimeout(() => {
                    try {
                        setInputHeight(initInputHeight)
                    } catch (e) {
                        console.log("设置高度出错")
                    }
                }, 100)
                if (!remarks) {
                    Alert.alert("", "信息发送失败。0001");
                    setSending(false)
                    return;
                }
                let remarksRes = {msg: remarks, type: "Gchat", sender: wallet.address,};

                var tx: any = await transfer(wallet.seed, wallet.address, Q_Address, "0.002", JSON.stringify(remarksRes));

                if (tx.reason != 1) {

                    Alert.alert(tx.reason.toString(), locale._('Assets.send.sendFail'));
                    setSending(false)
                } else {
                    await insertData_Transfer(tx, Q_Address);
                    await addTx(tx);
                    setSending(false)
                }
                scrollToEnd();
            } catch (e) {
                console.log("发送信息出错了" + e)
                Alert.alert(locale._('Assets.send.sendFail'));
                scrollToEnd();
                setSending(false)
            }
        }
        else if (res.type == "changeText") {
            setSendMsg(res.msg);
        }
    }

    const keyboardAccessoryViewContent = () => {
        return (
            <View style={{flexDirection:"row",paddingBottom:15,backgroundColor:"#F6F6F6",borderTopColor:"#E6E6E6",borderTopWidth:1}}>
                <View style={{borderTopWidth: 20, borderColor: '#bbb'}}/>
                <View style={{flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 2,}}>
                    <TextInput
                        style={{
                        width:width*0.7,
                        borderRadius:width*0.01,
                        marginLeft:width*0.05,
                        height:inputHeight,
                        marginTop:height*0.02,
                        backgroundColor:"#FFF",
                        padding:0,
                        paddingLeft:width*0.01,
                        fontSize:width/360*16,
                        letterSpacing:1,
                        marginBottom:0,
                        lineHeight:width/360*20,
                        alignSelf:"center"
                    }}
                        onContentSizeChange={(e)=>{
                            if((e.nativeEvent.contentSize.height) >= width/360*20*4)
                            {
                                setInputHeight(width/360*20*4)
                            }
                            else
                            {
                                setInputHeight(e.nativeEvent.contentSize.height)
                            }
                            if((e.nativeEvent.contentSize.height) < width/360*35)
                            {
                                setInputHeight(width/360*35)
                            }
                        }}
                        underlineColorAndroid={'transparent'}
                        blurOnSubmit={false}
                        multiline={true}
                        maxLength={1000}
                        value={SendMsg}
                        onFocus={() => {}}
                        onChangeText={
                            (value) => {
                                setSendMsg(value);
                            }
                        }
                    />
                    <TouchableOpacity
                        onPress={async () => {
                            if (SendMsg == "") {
                                return;
                            }
                            setSending(true)
                            try {

                                let remarks = encryptedInformation_Key(SendMsg,Q_Key);
                                setSendMsg("");
                                setTimeout(()=>{
                                    try {
                                        setInputHeight(initInputHeight)
                                    }catch (e) {
                                        console.log("设置高度出错")
                                    }
                                },100)
                                if(!remarks)
                                {
                                    Alert.alert("","信息发送失败。0001");
                                    setSending(false)
                                    return ;
                                }
                                let remarksRes = { msg: remarks, type: "Gchat",sender:wallet.address,};

                                var tx:any = await transfer(wallet.seed, wallet.address, Q_Address, "0.002", JSON.stringify(remarksRes));

                                if (tx.reason!=1)
                                {

                                    Alert.alert(tx.reason.toString(), locale._('Assets.send.sendFail'));
                                    setSending(false)
                                }
                                else
                                {
                                    await insertData_Transfer(tx,Q_Address);
                                    await addTx(tx);
                                    setSending(false)
                                }
                                scrollToEnd();
                            }catch (e) {
                                console.log("发送信息出错了"+e)
                                Alert.alert(locale._('Assets.send.sendFail'));
                                scrollToEnd();
                                setSending(false)
                            }
                        }
                        }
                        disabled={sending}
                        style={{
                            width:width*0.15,height:height*0.047,backgroundColor:sending?"grey":"#00C154",
                            marginLeft:width*0.05,marginTop:height*0.02,borderRadius:width*0.01,
                            justifyContent:"center",alignItems:"center",alignSelf:"flex-end"
                        }}>
                        {
                            sending?
                                <ActivityIndicator
                                    animating={true}
                                    color={'white'}
                                    size={"small"}
                                />
                                :
                                <Text style={{color:"white",fontWeight:"bold"}}>
                                    {locale._("MeChat_ChatView_Send")}
                                </Text>
                        }
                    </TouchableOpacity>
                </View>
            </View>
        );
    }

    return (
        <>
            {
                showWaiting?
                    <View style={{width:width,height:height,backgroundColor:"#F5F5F5"}}>
                        <ActivityIndicator
                            animating={true}
                            color={'lightblue'}
                            size={50}
                            style={{width:width,backgroundColor:"#FFFAFA69",marginTop:0.3*height}}
                        />
                        <Text style={{alignSelf:"center",marginTop:20}}>{formartMoney((parseFloat(progressLength)*100).toString(),2)}% {TipInfo}</Text>
                        <View style={{backgroundColor:"#DCDCDC",width:width*0.8,height:20,borderRadius:10,marginTop:25,alignSelf:"center"}}/>
                        <View style={{backgroundColor:"#69BDF4",width:width*0.8*parseFloat(progressLength)>20?width*0.8*parseFloat(progressLength):20,height:20,borderRadius:10,marginTop:-20,alignSelf:"flex-start",marginLeft:width*0.1}}/>
                    </View>:null
            }
            <View style={{flex:1,width:width,backgroundColor:"#F6F6F6",position:"relative"}}>
                <ScrollView
                    style={{width:width,height:scrollHeight}}
                    keyboardDismissMode="on-drag"
                    onTouchStart={()=>{setTimeout(()=>setShowPickIndex(-1),200);}}
                    onMomentumScrollEnd={contentViewScroll}
                    ref={ref_ScrollView}>
                    {
                        Q_Chat.length?
                            Q_Chat.map((item:any,index:any)=>(
                                item.display!==false?
                                    <View style={{marginBottom:10}} key={index}>
                                        {
                                            showTime(item.timeStamp,index)?
                                                <Text style={{fontSize:12,color:"grey",alignSelf:"center",marginTop:3,marginBottom:3}}>{timeFormat(item.timeStamp)}</Text>
                                                :null
                                        }
                                        <View style={{width:width,flexDirection:item.sender===wallet.address?"row-reverse":"row"}}>
                                            <ImageBackground style={{width:50,height:50}} source={logo} />
                                            <View style={{flexDirection:"column"}}>
                                                {
                                                    item.sender!==wallet.address?
                                                        <Text style={{alignSelf:"flex-start",fontSize:10,lineHeight:16}}>{item.sender.slice(0,5)+"..."+item.sender.slice(-5)}</Text>
                                                        :
                                                        <Text style={{height:10}}></Text>
                                                }

                                                <TouchableOpacity
                                                    onLongPress={()=>{
                                                        setShowPickIndex(index);
                                                    }}
                                                >
                                                    <View style={{flexDirection:item.sender===wallet.address?"row-reverse":"row"}}>
                                                        <View style={{
                                                            width: 0,
                                                            height: 0,
                                                            marginTop:10,
                                                            borderTopWidth: 6,
                                                            borderTopColor: 'transparent',
                                                            borderRightWidth: item.sender===wallet.address?3:6,
                                                            borderRightColor: item.sender===wallet.address?'transparent':'white',
                                                            borderLeftWidth: item.sender===wallet.address?3:6,
                                                            borderLeftColor: item.sender===wallet.address?'#95EB6F':'transparent',
                                                            borderBottomWidth: 6,
                                                            borderBottomColor: 'transparent',
                                                        }} />
                                                        <View>
                                                            {
                                                                showPick(index)?
                                                                    <View
                                                                        style={{
                                                                            alignSelf: "center",
                                                                            width: 0,
                                                                            height: 0,
                                                                            marginTop: -9,
                                                                            borderTopWidth: 6,
                                                                            borderTopColor: 'grey',
                                                                            borderRightWidth: 6,
                                                                            borderRightColor: 'transparent',
                                                                            borderLeftWidth: 6,
                                                                            borderLeftColor: 'transparent',
                                                                            borderBottomWidth: 6,
                                                                            borderBottomColor: 'transparent',
                                                                        }}
                                                                    >
                                                                        {
                                                                            item.sender === wallet.address ?

                                                                                <View style={{
                                                                                    alignSelf: "center",
                                                                                    flexDirection: "row",
                                                                                    backgroundColor: "grey",
                                                                                    marginRight:50,
                                                                                    height: 44,
                                                                                    marginTop:-50,
                                                                                    width: item.hash ? 165 : 109.4
                                                                                }}>
                                                                                    <TouchableHighlight onPress={() => {
                                                                                        const del = async () => {
                                                                                            //删除后面补上
                                                                                        }
                                                                                        Alert.alert('', `确认删除？`, [
                                                                                            {
                                                                                                text: locale?._('cancel'),
                                                                                                onPress: () => console.log("Cancel Pressed"),
                                                                                                style: "cancel"
                                                                                            }, {
                                                                                                text: locale?._('ok'),
                                                                                                onPress: async () => {
                                                                                                    await del();
                                                                                                }
                                                                                            }
                                                                                        ]);
                                                                                    }}
                                                                                                        style={{
                                                                                                            padding: 12,
                                                                                                            borderWidth: 1 / scale,
                                                                                                            borderColor: "#C0C0C0",
                                                                                                            borderBottomColor: "transparent"
                                                                                                        }}
                                                                                    >
                                                                                        <Text style={{
                                                                                            fontSize: 15,
                                                                                            color: "#fff"
                                                                                        }}>
                                                                                            删除
                                                                                        </Text>
                                                                                    </TouchableHighlight>
                                                                                    {item.hash ?
                                                                                        <TouchableHighlight onPress={() => {
                                                                                            setDetailInfo(item);
                                                                                        }}
                                                                                                            style={{
                                                                                                                padding: 12,
                                                                                                                borderWidth: 1 / scale,
                                                                                                                borderColor: "#C0C0C0",
                                                                                                                borderBottomColor: "transparent"
                                                                                                            }}
                                                                                        >
                                                                                            <Text style={{
                                                                                                fontSize: 15,
                                                                                                color: "#fff"
                                                                                            }}>
                                                                                                详情
                                                                                            </Text>
                                                                                        </TouchableHighlight>
                                                                                        : null
                                                                                    }
                                                                                    <TouchableHighlight onPress={() => {
                                                                                        onCopy(item.msg)
                                                                                    }}
                                                                                                        style={{
                                                                                                            padding: 12,
                                                                                                            borderWidth: 1 / scale,
                                                                                                            borderColor: "#C0C0C0",
                                                                                                            borderBottomColor: "transparent"
                                                                                                        }}
                                                                                    >
                                                                                        <Text style={{
                                                                                            fontSize: 15,
                                                                                            color: "#fff"
                                                                                        }}>
                                                                                            复制
                                                                                        </Text>
                                                                                    </TouchableHighlight>
                                                                                </View>
                                                                                :
                                                                                <View style={{
                                                                                    alignSelf: "center",
                                                                                    flexDirection: "row",
                                                                                    position: "absolute",
                                                                                    backgroundColor: "grey",
                                                                                    marginLeft:50,
                                                                                    marginTop:-50,
                                                                                    height: 44,
                                                                                    width: item.hash ? 165 : 109.4,
                                                                                }}>
                                                                                    <TouchableHighlight onPress={() => {
                                                                                        const del = async () => {
                                                                                            //删除后面补上
                                                                                        }
                                                                                        Alert.alert('', `确认删除？`, [
                                                                                            {
                                                                                                text: locale?._('cancel'),
                                                                                                onPress: () => console.log("Cancel Pressed"),
                                                                                                style: "cancel"
                                                                                            }, {
                                                                                                text: locale?._('ok'),
                                                                                                onPress: async () => {
                                                                                                    await del();
                                                                                                }
                                                                                            }
                                                                                        ]);
                                                                                    }}
                                                                                                        style={{
                                                                                                            padding: 12,
                                                                                                            borderWidth: 1 / scale,
                                                                                                            borderColor: "#C0C0C0",
                                                                                                            borderBottomColor: "transparent"
                                                                                                        }}
                                                                                    >
                                                                                        <Text style={{
                                                                                            fontSize: 15,
                                                                                            color: "#fff"
                                                                                        }}>
                                                                                            删除
                                                                                        </Text>
                                                                                    </TouchableHighlight>
                                                                                    {item.hash ?
                                                                                        <TouchableHighlight onPress={() => {
                                                                                            setDetailInfo(item);
                                                                                        }}
                                                                                                            style={{
                                                                                                                padding: 12,
                                                                                                                borderWidth: 1 / scale,
                                                                                                                borderColor: "#C0C0C0",
                                                                                                                borderBottomColor: "transparent"
                                                                                                            }}
                                                                                        >
                                                                                            <Text style={{
                                                                                                fontSize: 15,
                                                                                                color: "#fff"
                                                                                            }}>
                                                                                                详情
                                                                                            </Text>
                                                                                        </TouchableHighlight>
                                                                                        : null
                                                                                    }
                                                                                    <TouchableHighlight onPress={() => {
                                                                                        onCopy(item.msg)
                                                                                    }}
                                                                                                        style={{
                                                                                                            padding: 12,
                                                                                                            borderWidth: 1 / scale,
                                                                                                            borderColor: "#C0C0C0",
                                                                                                            borderBottomColor: "transparent"
                                                                                                        }}
                                                                                    >
                                                                                        <Text style={{
                                                                                            fontSize: 15,
                                                                                            color: "#fff"
                                                                                        }}>
                                                                                            复制
                                                                                        </Text>
                                                                                    </TouchableHighlight>
                                                                                </View>

                                                                        }
                                                                    </View>
                                                                    :null
                                                            }
                                                            <Text selectable={false} style={{padding:7,fontSize:width/360*15,backgroundColor:item.sender===wallet.address?"#95EB6F":"white",maxWidth:width*0.7,lineHeight:width/360*22}}>{item.msg}</Text>
                                                        </View>
                                                        {
                                                            item.showTraning?
                                                                <TouchableOpacity
                                                                    activeOpacity={1}
                                                                    style={{flexDirection:"column",justifyContent:"center"}}
                                                                    onPress={()=>{
                                                                        setDetailInfo(item)
                                                                    }}
                                                                >
                                                                    <ActivityIndicator
                                                                        animating={true}
                                                                        color={'grey'}
                                                                        size={width/360*25}
                                                                        style={{
                                                                            marginLeft: item.sender === wallet.address ? 0 : 15,
                                                                            marginRight: item.sender === wallet.address ? 15 : 0}}
                                                                    />
                                                                </TouchableOpacity>:null
                                                        }
                                                        {
                                                            item.showFalse?
                                                                <Icon type='font-awesome' name='exclamation-circle' color='#F58585' size={24}
                                                                      style={{
                                                                          marginTop:5,
                                                                          marginLeft: item.sender === wallet.address ? 0 : 15,
                                                                          marginRight: item.sender === wallet.address ? 15 : 0}} />:null
                                                        }
                                                    </View>
                                                </TouchableOpacity>
                                            </View>
                                        </View>
                                    </View>
                                    :null
                            )):null
                    }
                </ScrollView>
                {/* 输入框和发送按钮*/}
                <View style={{flexDirection:"row",paddingBottom:15,backgroundColor:"#F6F6F6",borderTopColor:"#E6E6E6",borderTopWidth:1}}>
                    <View style={{borderTopWidth: 20, borderColor: '#bbb'}}/>
                    <View style={{flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 2}}>
                        <TouchableOpacity
                            onPress={()=>{
                                setInput_visible(true);
                            }}
                            activeOpacity={1}
                            style={{
                                width:width*0.7,
                                borderRadius:width*0.01,
                                marginLeft:width*0.05,
                                minHeight:width/360*35,
                                maxHeight:width/360*20*4+10,
                                marginTop:height*0.02,
                                backgroundColor:"#FFF",
                                padding:5,
                                paddingLeft:width*0.01,

                                marginBottom:0,
                                justifyContent:"center",
                                alignSelf:"center"
                            }}
                        >
                            <Text
                                numberOfLines={4}
                                style={{
                                fontSize:width/360*16,
                                letterSpacing:1,
                                lineHeight:width/360*20,
                                }}>
                                {SendMsg}
                            </Text>
                        </TouchableOpacity>
                        <TouchableOpacity
                            onPress={async () => {
                                if (SendMsg == "") {
                                    return;
                                }
                                setSending(true)
                                try {

                                    let remarks = encryptedInformation_Key(SendMsg,Q_Key);
                                    setSendMsg("");
                                    setTimeout(()=>{
                                        try {
                                            setInputHeight(initInputHeight)
                                        }catch (e) {
                                            console.log("设置高度出错")
                                        }
                                    },100)
                                    if(!remarks)
                                    {
                                        Alert.alert("","信息发送失败。0001");
                                        setSending(false)
                                        return ;
                                    }
                                    let remarksRes = { msg: remarks, type: "Gchat",sender:wallet.address,};

                                    var tx:any = await transfer(wallet.seed, wallet.address, Q_Address, "0.002", JSON.stringify(remarksRes));

                                    if (tx.reason!=1)
                                    {

                                        Alert.alert(tx.reason.toString(), locale._('Assets.send.sendFail'));
                                        setSending(false)
                                    }
                                    else
                                    {
                                        await insertData_Transfer(tx,Q_Address);
                                        await addTx(tx);
                                        setSending(false)
                                    }
                                    scrollToEnd();
                                }catch (e) {
                                    console.log("发送信息出错了"+e)
                                    Alert.alert(locale._('Assets.send.sendFail'));
                                    scrollToEnd();
                                    setSending(false)
                                }
                            }
                            }
                            disabled={sending}
                            style={{
                                width:width*0.15,height:height*0.047,backgroundColor:sending?"grey":"#00C154",
                                marginLeft:width*0.05,marginTop:height*0.02,borderRadius:width*0.01,
                                justifyContent:"center",alignItems:"center",alignSelf:"flex-end"
                            }}>
                            {
                                sending?
                                    <ActivityIndicator
                                        animating={true}
                                        color={'white'}
                                        size={"small"}
                                    />
                                    :
                                    <Text style={{color:"white",fontWeight:"bold"}}>
                                        {locale._("MeChat_ChatView_Send")}
                                    </Text>
                            }
                        </TouchableOpacity>
                    </View>
                </View>
                {/*<View>*/}
                {/*    <KeyboardAccessoryView*/}
                {/*        renderContent={keyboardAccessoryViewContent}*/}
                {/*        onHeightChanged={(height:any) => {*/}
                {/*        }} />*/}
                {/*</View>*/}
            </View>
            {/* 评论式输入框*/}
            <ChatInput visible={Input_visible} msg={SendMsg} back={Input_back}
            />
            {/* 交易详情页面*/}
            <ChatTranDetail addressIn={Detail_addressIn} addressOut={Detail_addressOut}
                            timeStamp={Detail_timeStamp} blockHeight={Detail_blockHeight}
                            hash={Detail_hash} msg={Detail_msg} visible={Detail_visible}
                            back={Detail_back} navigation={navigation}
            />
        </>
    );
};

export default ChatGroupView;
